package com.founder.gateway.orm.fzapi.bean.entity;

import com.founder.gateway.orm.fzapi.bean.dto.BlogDto;
import com.founder.gateway.orm.fzapi.bean.dto.UserDto;
import com.founder.gateway.orm.fzapi.bean.mapper.BlogMapper;
import com.founder.gateway.orm.fzapi.bean.mapper.UserMapper;
import com.founder.gateway.system.bean.DbConnStructure;
import org.setu.framework.annotation.description.SetuDescription;
import org.setu.framework.bean.EntityBean;
import org.setu.framework.jdbc.annotation.TableInfo;

import javax.persistence.*;

/******************************************************************************
 * @Package: [com.founder.gateway.orm.fzapi.bean.entity.BlogEntity]
 * @ClassName: [BlogEntity]
 * @Description: [一句话描述该类的功能]
 * @Author: [fengli@founder.com.cn]  
 * @CreateDate: [2019/1/11 16:50]   
 * @UpdateUser: [fengli@founder.com.cn (如多次修改保留历史记录，增加修改记录)]   
 * @UpdateDate: [2019/1/11 16:50，(如多次修改保留历史记录，增加修改记录)]   
 * @UpdateRemark: [说明本次修改内容, (如多次修改保留历史记录 ， 增加修改记录)]
 * @Version: [v1.0]
 * ${tags}
 */
@Entity
@Table(name="blog")
@TableInfo(dbConn = DbConnStructure.DC$GATEWAY, dbName = DbConnStructure.fz_api)
public class BlogEntity extends EntityBean<BlogEntity, BlogDto, BlogMapper> {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "UUIDGenerator")
    @Column(name = "id", length = 32, nullable = false, columnDefinition = "varchar")
    @SetuDescription(describe = "博客id")
    private String id;


    @Column(name = "blog",length=255,nullable=false,columnDefinition="varchar")
    @SetuDescription(describe = "博客内容")
    private String blog;


    @Column(name = "userId",length=32,nullable=false,columnDefinition="varchar")
    @SetuDescription(describe = "用户id")
    private String userId;

    public UserEntity getUser() {
        return user;
    }

    public void setUser(UserEntity user) {
        this.user = user;
    }

    @ManyToOne
    @JoinColumn(name = "userId")
    private UserEntity user;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBlog() {
        return blog;
    }

    public void setBlog(String blog) {
        this.blog = blog;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
}
